package me.jessyan.armscomponent.app.mvp.ui.holder;

import android.view.View;

import androidx.annotation.NonNull;

import com.jess.arms.base.BaseHolder;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.utils.ArmsUtils;

import me.jessyan.armscomponent.app.mvp.model.entity.diyRecite;

public class DiyReciteItemHolder extends BaseHolder<diyRecite> {
   /* @BindView(R2.id.iv_avatar)
    ImageView mAvatar;
    @BindView(R2.id.tv_name)
    TextView mName;*/
    private ImageLoader mImageLoader;//用于加载图片的管理类,默认使用 Glide,使用策略模式,可替换框架
    private AppComponent mAppComponent;
    public DiyReciteItemHolder(View itemView) {
        super(itemView);
        mAppComponent = ArmsUtils.obtainAppComponentFromContext(itemView.getContext());
        mImageLoader = mAppComponent.imageLoader();
    }

    @Override
    public void setData(@NonNull diyRecite data, int position) {
        /*Observable.just(data.getTitle())
                .subscribe(s -> mName.setText(s));

        //itemView 的 Context 就是 Activity, Glide 会自动处理并和该 Activity 的生命周期绑定
        mImageLoader.loadImage(itemView.getContext(),
                CommonImageConfigImpl
                        .builder()
                        .url(data.getImages().get(0))
                        .imageView(mAvatar)
                        .build());*/
    }
    @Override
    protected void onRelease() {
        /*mImageLoader.clear(mAppComponent.application(), CommonImageConfigImpl.builder()
                .imageViews(mAvatar)
                .build());*/
    }
}
